/*
 *此javaCode由YMS-JDBC替换工具生成，原mapper位置com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper
 */
package com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.impl;

import com.yonyou.iuap.yms.api.IYmsJdbcApi;
import com.yonyou.iuap.yms.param.*;
import com.yonyou.iuap.yms.param.ResultSetProcessor;
import com.yonyou.iuap.yms.processor.*;
import com.yonyou.iuap.yms.replace.CollectionUtil;
import com.yonyou.ucf.mdf.app.isvdxq.firstpart.RFIDCodeDetail.entity.storeRecordOtherOut;
import com.yonyou.ucf.mdf.app.isvdxq.secondpart.entity.CheckdiffEntity;
import com.yonyou.ucf.mdf.app.isvdxq.secondpart.entity.CheckresultEntity;
import com.yonyou.ucf.mdf.app.isvdxq.secondpart.entity.StorerecordEntity;
import com.yonyou.ucf.mdf.app.isvdxq.secondpart.model.StorerecordBean;
import java.sql.Types;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class StorerecordEntityMapperImpl {
    
    @Autowired
    private IYmsJdbcApi ymsJdbcApi;
    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectListByOrdertype
    
    public List<StorerecordEntity> selectListByOrdertype(String orderid, String ordertype, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select a.*   from dxq_storerecord a  where a.dr=0 and a.ytenant_id=?  and a.orderid = ? and a.ordertype = ?;";
        parameter.addParam(tenant_id);
		parameter.addParam(orderid);
		parameter.addParam(ordertype);

        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectAllForCheckresult
    
    public List<CheckresultEntity> selectAllForCheckresult(String tenantId) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_checkresult where `ytenant_id` = ?;\n";
        parameter.addParam(tenantId);

        ResultSetProcessor processor = new AutoBeanListProcessor(new CheckresultEntity());
        return (List<CheckresultEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.getByPickbatchno
    
    public List<StorerecordBean> getByPickbatchno(String orderid, String pickbatchno, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);

		StringBuilder sqlBuilder = new StringBuilder();
        sqlBuilder.append(" select a.*,b.rfid_code,b.location_id,b.rfid_status  from dxq_storerecord a inner join dxq_coderfid b on a.rfidcodeId=b.id ");
		sqlBuilder.append(" where a.orderid= ? and a.pickbatchno= ?  and a.dr=0 AND a.ytenant_id= ?; ");
        parameter.addParam(orderid);
		parameter.addParam(pickbatchno);
		parameter.addParam(tenant_id);

		String sql = sqlBuilder.toString();
		ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordBean());
        return (List<StorerecordBean>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.insert
    
    public int insert(StorerecordEntity record) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "insert into dxq_storerecord (`id`, `ordercode`,  `ordertype`, `orderstatus`,  `rfidcodeId`, `orderid`,  `orderdetailid`, `dr`, `ytenant_id`, `pk_temp`,  `version`, `create_time`,  `modify_time`, `creator`,  `modifier`, `rfidcode`,  `orderstoreId`, `stockId`,  `priceUOM`,  `invExchRate`, `unitExchangeType`,  `invPriceExchRate`, `unitExchangeTypePrice`,  `sourceid`, `sourceautoid`,  `source`, `firstsourceid`,  `firstsourceautoid`, `firstsource`,  `upcode`, `firstupcode`,  `poid`, `podetailid`,  `pocode`, `batch_no`,  `pickstatus`, `pickbatchno`, `stockUnitId`, `stock_unit_id`,  `stock_unit_code`,`stock_unit_name`, `unitId`, `unit_code`,`unit_name`, `warehouse_id`,`warehouse_code`,  `warehouse_name`, `product_id`, `product_name`, `product_code`, `product_sku_id`,  `product_sku_code`, `product_sku_name`, `batchno_dxq`, `type`, `batchno`, `epc_tid`,`f_stock_count`, `productDate`, `invalidDate`, `epc_status`)  values (?, ?,  ?, ?,  ?, ?,  ?, ?,  ?,  ?, ?, now(),  ?, ?,  ?, ?,  ?, ?,  ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?,?, ?,?, ?)\n";
        parameter.addParamWithType(record.getId(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrdercode(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrdertype(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrderstatus(), Types.INTEGER);
		parameter.addParamWithType(record.getRfidcodeId(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrderid(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrderdetailid(), Types.VARCHAR);
		parameter.addParamWithType(record.getDr(), Types.SMALLINT);
		parameter.addParamWithType(record.getYtenant_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getPk_temp(), Types.VARCHAR);
		parameter.addParamWithType(record.getVersion(), Types.INTEGER);
		parameter.addParamWithType(record.getModify_time(), Types.TIMESTAMP);
		parameter.addParamWithType(record.getCreator(), Types.VARCHAR);
		parameter.addParamWithType(record.getModifier(), Types.VARCHAR);
		parameter.addParamWithType(record.getRfidcode(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrderstoreId(), Types.VARCHAR);
		parameter.addParamWithType(record.getStockId(), Types.VARCHAR);
		parameter.addParamWithType(record.getPriceUOM(), Types.VARCHAR);
		parameter.addParamWithType(record.getInvExchRate(), Types.VARCHAR);
		parameter.addParamWithType(record.getUnitExchangeType(), Types.VARCHAR);
		parameter.addParamWithType(record.getInvPriceExchRate(), Types.VARCHAR);
		parameter.addParamWithType(record.getUnitExchangeTypePrice(), Types.VARCHAR);
		parameter.addParamWithType(record.getSourceid(), Types.VARCHAR);
		parameter.addParamWithType(record.getSourceautoid(), Types.VARCHAR);
		parameter.addParamWithType(record.getSource(), Types.VARCHAR);
		parameter.addParamWithType(record.getFirstsourceid(), Types.VARCHAR);
		parameter.addParamWithType(record.getFirstsourceautoid(), Types.VARCHAR);
		parameter.addParamWithType(record.getFirstsource(), Types.VARCHAR);
		parameter.addParamWithType(record.getUpcode(), Types.VARCHAR);
		parameter.addParamWithType(record.getFirstupcode(), Types.VARCHAR);
		parameter.addParamWithType(record.getPoid(), Types.VARCHAR);
		parameter.addParamWithType(record.getPodetailid(), Types.VARCHAR);
		parameter.addParamWithType(record.getPocode(), Types.VARCHAR);
		parameter.addParamWithType(record.getBatch_no(), Types.VARCHAR);
		parameter.addParamWithType(record.getPickstatus(), Types.INTEGER);
		parameter.addParamWithType(record.getPickbatchno(), Types.VARCHAR);
		parameter.addParamWithType(record.getStockUnitId(), Types.VARCHAR);
		parameter.addParamWithType(record.getStock_unit_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getStock_unit_code(), Types.VARCHAR);
		parameter.addParamWithType(record.getStock_unit_name(), Types.VARCHAR);
		parameter.addParamWithType(record.getUnitId(), Types.VARCHAR);
		parameter.addParamWithType(record.getUnit_code(), Types.VARCHAR);
		parameter.addParamWithType(record.getUnit_name(), Types.VARCHAR);
		parameter.addParamWithType(record.getWarehouse_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getWarehouse_code(), Types.VARCHAR);
		parameter.addParamWithType(record.getWarehouse_name(), Types.VARCHAR);
		parameter.addParamWithType(record.getProduct_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getProduct_name(), Types.VARCHAR);
		parameter.addParamWithType(record.getProduct_code(), Types.VARCHAR);
		parameter.addParamWithType(record.getProduct_sku_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getProduct_sku_code(), Types.VARCHAR);
		parameter.addParamWithType(record.getProduct_sku_name(), Types.VARCHAR);
		parameter.addParamWithType(record.getBatchno_dxq(), Types.VARCHAR);
		parameter.addParamWithType(record.getType(), Types.INTEGER);
		parameter.addParamWithType(record.getBatchno(), Types.VARCHAR);
		parameter.addParamWithType(record.getEpc_tid(), Types.VARCHAR);
		parameter.addParamWithType(record.getF_stock_count(), Types.DOUBLE);
		parameter.addParamWithType(record.getProductDate(), Types.VARCHAR);
		parameter.addParamWithType(record.getInvalidDate(), Types.VARCHAR);
		parameter.addParamWithType(record.getEpc_status(), Types.INTEGER);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectByPickbatchno
    
    public List<StorerecordEntity> selectByPickbatchno(String orderid, String pickbatchno, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_storerecord   where orderid =? and pickbatchno=?  and dr=0 AND ytenant_id=?;\n";
        parameter.addParam(orderid);
		parameter.addParam(pickbatchno);
		parameter.addParam(tenant_id);

        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.editInstock
    
    public int editInstock(List<String> ids, String sourceid, String sourceautoid, String Source, String Firstsource, String Firstsourceautoid, String Firstsourceid, String Upcode, String Firstupcode, String Poid, String Podetailid, String Pocode, String modifier, String tenant_id, String stockUnitId, String stockUnitName, String stockUnitCode, String batch_no) throws Exception {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" update dxq_storerecord set epc_status=0,batch_no=?, modify_time=now(), modifier=?, sourceid=?, sourceautoid=?, source=?, firstsourceid=?, firstsourceautoid=?, firstsource=?, upcode=?, firstupcode=?, stockUnitId=?, stock_unit_id=?, stock_unit_name=?, stock_unit_code=?, poid=?, podetailid=?, pocode=? where `dr`=0 ");
		parameter.addParam(batch_no);
		parameter.addParam(modifier);
		parameter.addParam(sourceid);
		parameter.addParam(sourceautoid);
		parameter.addParam(Source);
		parameter.addParam(Firstsourceid);
		parameter.addParam(Firstsourceautoid);
		parameter.addParam(Firstsource);
		parameter.addParam(Upcode);
		parameter.addParam(Firstupcode);
		parameter.addParam(stockUnitId);
		parameter.addParam(stockUnitId);
		parameter.addParam(stockUnitName);
		parameter.addParam(stockUnitCode);
		parameter.addParam(Poid);
		parameter.addParam(Podetailid);
		parameter.addParam(Pocode);
		if (CollectionUtil.isNotEmpty(ids)) {
			sqlBuilder.append(" and `id` in  ( ");
			String separator0 = " , ";
			for (int index = 0; index < ids.size(); index++) {
				String item = ids.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < ids.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}else{
			sqlBuilder.append(" and `id` in  ( '' ) ");
		}
		sqlBuilder.append(" and ytenant_id=?; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.getDaohuoList
    
    public List<StorerecordEntity> getDaohuoList(String orderid, String tenant_id, String creator) throws Exception {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "SELECT a.*   FROM `dxq_storerecord` a   WHERE a.`orderid`=? and a.creator=?   and (a.batch_no IS NULL or a.batch_no='')  AND a.`dr`=0 and a.ytenant_id=? order by a.id\n";
        parameter.addParam(orderid);
		parameter.addParam(creator);
		parameter.addParam(tenant_id);

        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectByPrimaryKey
    
    public StorerecordEntity selectByPrimaryKey(String id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_storerecord where `id` = ?\n";
        parameter.addParamWithType(id, Types.VARCHAR);

        ResultSetProcessor processor = new AutoBeanProcessor(new StorerecordEntity());
        return (StorerecordEntity) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.InsertStorerecordOtherOut
    
    public int InsertStorerecordOtherOut(List<storeRecordOtherOut> storeRecordOtherOuts) throws Exception {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" INSERT INTO `dxq_storerecord`(`ordercode`,`orderid`,`ordertype`,`orderstatus`, `rfidcodeId`,`rfidcode`,`orderdetailid`,`stockId`, `stockUnitId`,`source`, `firstsourceid`,`sourceid`,`poid`,`podetailid`,`pocode`, `unit_name`,`warehouse_id`,`warehouse_name`, `product_id`,`product_code`,`product_name`, `product_sku_id`,`f_stock_count`, `batchno_dxq`,`batch_no`,`batchno`,`productDate`,`invalidDate`, `pubts`, `dr`, `ytenant_id`, `create_time`,`modify_time`,`creator`,`modifier`,id) VALUES ");
		if (CollectionUtil.isNotEmpty(storeRecordOtherOuts)) {
			String separator0 = " , ";
			for (int i = 0; i < storeRecordOtherOuts.size(); i++) {
				storeRecordOtherOut item = storeRecordOtherOuts.get(i);
				sqlBuilder.append(" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?,?,?, ?,?, ?, ?,?, ?, ?, ?, ?, ?, ?,?,?, ?, 0, ?, now(), now(),?,?,?) ");
				parameter.addParamWithType(item.getOrdercode(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderid(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrdertype(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderstatus(), Types.VARCHAR);
				parameter.addParamWithType(item.getRfidcodeId(), Types.VARCHAR);
				parameter.addParamWithType(item.getRfidcode(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderdetailid(), Types.VARCHAR);
				parameter.addParamWithType(item.getStockId(), Types.VARCHAR);
				parameter.addParamWithType(item.getStockUnitId(), Types.VARCHAR);
				parameter.addParamWithType(item.getSource(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstsourceid(), Types.VARCHAR);
				parameter.addParamWithType(item.getSourceid(), Types.VARCHAR);
				parameter.addParamWithType(item.getPoid(), Types.VARCHAR);
				parameter.addParamWithType(item.getPodetailid(), Types.VARCHAR);
				parameter.addParamWithType(item.getPocode(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnit_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getWarehouse_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getWarehouse_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_code(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_sku_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getF_stock_count(), Types.DOUBLE);
				parameter.addParamWithType(item.getBatchno_dxq(), Types.VARCHAR);
				parameter.addParamWithType(item.getBatch_no(), Types.VARCHAR);
				parameter.addParamWithType(item.getBatchno(), Types.VARCHAR);
				parameter.addParamWithType(item.getProductDate(), Types.TIMESTAMP);
				parameter.addParamWithType(item.getInvalidDate(), Types.TIMESTAMP);
				parameter.addParamWithType(item.getPubts(), Types.TIMESTAMP);
				parameter.addParamWithType(item.getTenant_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getCreator(), Types.VARCHAR);
				parameter.addParamWithType(item.getModifier(), Types.VARCHAR);
				parameter.addParamWithType(item.getId(), Types.BIGINT);
				if (i < storeRecordOtherOuts.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
		}

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.EditEntity
    
    public int EditEntity(List<StorerecordEntity> updateList, String tenant_id) throws Exception {
		if (updateList == null || updateList.size()==0) return 0;
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		if (CollectionUtil.isNotEmpty(updateList)) {
			String separator0 = " ; ";
			for (int i = 0; i < updateList.size(); i++) {
				StorerecordEntity item = updateList.get(i);
				sqlBuilder.append(" update dxq_storerecord set `ordercode` = ?, `ordertype` = ?, `orderstatus` = ?, `rfidcodeId` = ?, `rfidcode` = ?, `orderid` = ?, `orderdetailid` = ?, `dr` = ?, `pk_temp` = ?, `version` = ?, `modify_time` = now(), `creator` = ?, `modifier` = ?, `pubts` = ?, `orderstoreId` = ?, `stockId` = ?, `stockUnitId` = ?, `priceUOM` = ?, `invExchRate` = ?, `unitExchangeType` = ?, `invPriceExchRate` = ?, `unitExchangeTypePrice` = ?, `sourceid` = ?, `sourceautoid` = ?, `source` = ?, `firstsourceid` = ?, `firstsourceautoid` = ?, `firstsource` = ?, `upcode` = ?, `firstupcode` = ?, `poid` = ?, `podetailid` = ?, `pocode` = ?, `batch_no` = ?, `batchno_dxq` = ?, `pickstatus` = ?, `pickbatchno` = ?, `f_stock_count` = ?, `batchno` = ?, `productDate` = ?, `epc_tid` = ?");
				sqlBuilder.append(" where `id`=? and ytenant_id=? ");
				parameter.addParamWithType(item.getOrdercode(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrdertype(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderstatus(), Types.INTEGER);
				parameter.addParamWithType(item.getRfidcodeId(), Types.VARCHAR);
				parameter.addParamWithType(item.getRfidcode(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderid(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderdetailid(), Types.VARCHAR);
				parameter.addParamWithType(item.getDr(), Types.INTEGER);
				parameter.addParamWithType(item.getPk_temp(), Types.VARCHAR);
				parameter.addParamWithType(item.getVersion(), Types.INTEGER);
				parameter.addParamWithType(item.getCreator(), Types.VARCHAR);
				parameter.addParamWithType(item.getModifier(), Types.VARCHAR);
				parameter.addParamWithType(item.getPubts(), Types.TIMESTAMP);
				parameter.addParamWithType(item.getOrderstoreId(), Types.VARCHAR);
				parameter.addParamWithType(item.getStockId(), Types.VARCHAR);
				parameter.addParamWithType(item.getStockUnitId(), Types.VARCHAR);
				parameter.addParamWithType(item.getPriceUOM(), Types.VARCHAR);
				parameter.addParamWithType(item.getInvExchRate(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnitExchangeType(), Types.VARCHAR);
				parameter.addParamWithType(item.getInvPriceExchRate(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnitExchangeTypePrice(), Types.VARCHAR);
				parameter.addParamWithType(item.getSourceid(), Types.VARCHAR);
				parameter.addParamWithType(item.getSourceautoid(), Types.VARCHAR);
				parameter.addParamWithType(item.getSource(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstsourceid(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstsourceautoid(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstsource(), Types.VARCHAR);
				parameter.addParamWithType(item.getUpcode(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstupcode(), Types.VARCHAR);
				parameter.addParamWithType(item.getPoid(), Types.VARCHAR);
				parameter.addParamWithType(item.getPodetailid(), Types.VARCHAR);
				parameter.addParamWithType(item.getPocode(), Types.VARCHAR);
				parameter.addParamWithType(item.getBatch_no(), Types.VARCHAR);
				parameter.addParamWithType(item.getBatchno_dxq(), Types.VARCHAR);
				parameter.addParamWithType(item.getPickstatus(), Types.INTEGER);
				parameter.addParamWithType(item.getPickbatchno(), Types.VARCHAR);
				parameter.addParamWithType(item.getF_stock_count(), Types.DOUBLE);
				parameter.addParamWithType(item.getBatchno(), Types.VARCHAR);
				parameter.addParamWithType(item.getProductDate(), Types.VARCHAR);
				parameter.addParamWithType(item.getEpc_tid(), Types.VARCHAR);
				parameter.addParam(item.getId());
				parameter.addParam(tenant_id);
				if (i < updateList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
		}

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectListByEpcId
    
    public StorerecordEntity selectListByEpcId(String epcId, String ordertype, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_storerecord   where ordertype=? and rfidcodeId = ?  and dr=0 AND ytenant_id=? limit 1;\n";
        parameter.addParam(ordertype);
		parameter.addParam(epcId);
		parameter.addParam(tenant_id);

        ResultSetProcessor processor = new AutoBeanProcessor(new StorerecordEntity());
        return (StorerecordEntity) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.EditStatus
    
    public int EditStatus(List<String> strList, String tenant_id, String modifier, String epc_status, String allotbatchno) {
		if (strList == null || strList.size()==0) return 0;
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" update dxq_storerecord set epc_status=?,modify_time=now(),modifier=?,batchno_dxq=? where id in ");
		parameter.addParam(epc_status);
		parameter.addParam(modifier);
		parameter.addParam(allotbatchno);
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and ytenant_id=? and dr=0; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectListByEpcs
    
    public List<StorerecordEntity> selectListByEpcs(List<String> strList, String ordertype, String epcstatus, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" select * from dxq_storerecord where ordertype=? and epc_status=? and rfidcode in ");
		parameter.addParam(ordertype);
		parameter.addParam(epcstatus);
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and dr=0 AND ytenant_id=?; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectListByEpcIds
    
    public List<StorerecordEntity> selectListByEpcIds(List<String> strList, String ordertype, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" select * from dxq_storerecord where ordertype=? and rfidcodeId in ");
		parameter.addParam(ordertype);
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and dr=0 AND ytenant_id=?; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectPage
    
    public List<StorerecordEntity> selectPage(String tenantId, int m, int n) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_storerecord where `ytenant_id` = ? limit ?,?;\n";
        parameter.addParam(tenantId);
		parameter.addParam(m);
		parameter.addParam(n);

        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.checkEntityByEpcIds
    
    public StorerecordEntity checkEntityByEpcIds(List<String> strList, String tenant_id) throws Exception {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" select * from `dxq_storerecord` where `rfidcodeId` in ");
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" AND `dr`=0 and ytenant_id=? and (batch_no IS not NULL and batch_no !='') limit 0,1; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        ResultSetProcessor processor = new AutoBeanProcessor(new StorerecordEntity());
        return (StorerecordEntity) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectEntityByPoid
    
    public StorerecordEntity selectEntityByPoid(String poid, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select a.*   from dxq_storerecord a  where a.ytenant_id=?  and a.poid = ? limit 1;\n";
        parameter.addParam(tenant_id);
		parameter.addParam(poid);

        ResultSetProcessor processor = new AutoBeanProcessor(new StorerecordEntity());
        return (StorerecordEntity) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectStorerecordByIds
    
    public List<StorerecordEntity> selectStorerecordByIds(List<String> strList, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" select * from dxq_storerecord where id in ");
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and dr=0 AND ytenant_id=?; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.EditBatchno_dxq
    
    public int EditBatchno_dxq(List<String> strList, String orderid, String ordertype, String tenant_id, String allotbatchno) {
		if (strList == null || strList.size()==0) return 0;
		SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" update dxq_storerecord set batchno_dxq=? where orderid=? and ordertype=? and rfidcode in ");
		parameter.addParam(allotbatchno);
		parameter.addParam(orderid);
		parameter.addParam(ordertype);
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and ytenant_id=? and dr=0; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectEntityByCodes
    
    public List<StorerecordEntity> selectEntityByCodes(List<String> codes, String tenantId) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" select * from dxq_storerecord where pocode in ");
		if (CollectionUtil.isNotEmpty(codes)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < codes.size(); index++) {
				String item = codes.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < codes.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" AND ytenant_id=?; ");
		parameter.addParam(tenantId);

        
        String sql = sqlBuilder.toString();
        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectEntityList
    
    public List<StorerecordEntity> selectEntityList(String orderid, String ordertype, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_storerecord  where dr=0 and ytenant_id=?  and orderid = ? and ordertype = ?;\n";
        parameter.addParam(tenant_id);
		parameter.addParam(orderid);
		parameter.addParam(ordertype);

        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectAllForCheckdiff
    
    public List<CheckdiffEntity> selectAllForCheckdiff(String tenantId) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_checkdiff where `ytenant_id` = ?;\n";
        parameter.addParam(tenantId);

        ResultSetProcessor processor = new AutoBeanListProcessor(new CheckdiffEntity());
        return (List<CheckdiffEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.outstockByEntity
    
    public int outstockByEntity(List<StorerecordEntity> updateList, String tenant_id) throws Exception {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		if (CollectionUtil.isNotEmpty(updateList)) {
			String separator0 = " ; ";
			for (int i = 0; i < updateList.size(); i++) {
				StorerecordEntity item = updateList.get(i);
				sqlBuilder.append(" update dxq_storerecord set epc_status=6,dr=1,modify_time=now(),modifier=?, source= ?, sourceid= ?, sourceautoid= ?, firstsourceid= ?, firstsourceautoid= ?, firstsource= ?,batch_no=?, upcode= ?, firstupcode= ?, poid= ?, podetailid= ?, pocode= ? ");
				sqlBuilder.append(" where `id`= ? and ytenant_id= ? AND `dr`= 0 ");
				parameter.addParam(item.getModifier());
				parameter.addParam(item.getSource());
				parameter.addParam(item.getSourceid());
				parameter.addParam(item.getSourceautoid());
				parameter.addParam(item.getFirstsourceid());
				parameter.addParam(item.getFirstsourceautoid());
				parameter.addParam(item.getFirstsource());
				parameter.addParam(item.getBatch_no());
				parameter.addParam(item.getUpcode());
				parameter.addParam(item.getFirstupcode());
				parameter.addParam(item.getPoid());
				parameter.addParam(item.getPodetailid());
				parameter.addParam(item.getPocode());
				parameter.addParam(item.getId());
				parameter.addParam(tenant_id);
				if (i < updateList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
		}

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.deleteStorerecordByIds
    
    public int deleteStorerecordByIds(List<String> strList, String modifier, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" update dxq_storerecord set dr=1,modify_time=now(),modifier=? where id in ");
		parameter.addParam(modifier);
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and ytenant_id=? and dr=0; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.deleteStorerecord
    
    public int deleteStorerecord(List<String> strList, String ordertype, String modifier, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" update dxq_storerecord set dr=1,modify_time=now(),modifier=? where ordertype=? and rfidcodeId in ");
		parameter.addParam(modifier);
		parameter.addParam(ordertype);
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and ytenant_id=? and dr=0; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectAll
    
    public List<StorerecordEntity> selectAll(String tenantId) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxq_storerecord where `ytenant_id` = ?;\n";
        parameter.addParam(tenantId);

        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectByOrderidAndEpcs
    
    public List<StorerecordEntity> selectByOrderidAndEpcs(String orderid, List<String> strList, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" select * from dxq_storerecord where orderid =? and rfidcode in ");
		parameter.addParam(orderid);
		if (CollectionUtil.isNotEmpty(strList)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < strList.size(); index++) {
				String item = strList.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and dr=0 AND ytenant_id=?; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.instockByEntity
    
    public int instockByEntity(List<StorerecordEntity> updateList, String batch_no, String modifier, String tenant_id) throws Exception {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		if (CollectionUtil.isNotEmpty(updateList)) {
			String separator0 = " ; ";
			for (int i = 0; i < updateList.size(); i++) {
				StorerecordEntity item = updateList.get(i);
				sqlBuilder.append(" update dxq_storerecord set epc_status=0,modify_time=now(), batch_no=?, modifier=?, source=?, sourceid=?, sourceautoid=?, firstsourceid=?, firstsourceautoid=?, firstsource =?, invalidDate=?, upcode=?, firstupcode=?, stockUnitId=?, stock_unit_id=?, stock_unit_name=?, stock_unit_code=?, poid=?, podetailid=?, pocode=? ");
				sqlBuilder.append(" where `id` =? and ytenant_id=? AND `dr`=0 ");
				parameter.addParam(batch_no);
				parameter.addParam(modifier);
				parameter.addParam(item.getSource());
				parameter.addParam(item.getSourceid());
				parameter.addParam(item.getSourceautoid());
				parameter.addParam(item.getFirstsourceid());
				parameter.addParam(item.getFirstsourceautoid());
				parameter.addParam(item.getFirstsource());
				parameter.addParam(item.getInvalidDate());
				parameter.addParam(item.getUpcode());
				parameter.addParam(item.getFirstupcode());
				parameter.addParam(item.getStockUnitId());
				parameter.addParam(item.getStock_unit_id());
				parameter.addParam(item.getStock_unit_name());
				parameter.addParam(item.getStock_unit_code());
				parameter.addParam(item.getPoid());
				parameter.addParam(item.getPodetailid());
				parameter.addParam(item.getPocode());
				parameter.addParam(item.getId());
				parameter.addParam(tenant_id);
				if (i < updateList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
		}

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.insertBatch
    
    public int insertBatch(List<StorerecordEntity> insertBatch) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" INSERT INTO `dxq_storerecord`(`id`, `ordercode`, `ordertype`, `orderstatus`, `rfidcodeId`, `orderid`, `orderdetailid`, `dr`, `ytenant_id`, `pk_temp`, `version`, `create_time`, `modify_time`, `creator`, `modifier`, `rfidcode`, `orderstoreId`, `stockId`, `priceUOM`, `invExchRate`, `unitExchangeType`, `invPriceExchRate`, `unitExchangeTypePrice`, `sourceid`, `sourceautoid`, `source`, `firstsourceid`, `firstsourceautoid`, `firstsource`, `upcode`, `firstupcode`, `poid`, `podetailid`, `pocode`, `batch_no`, `pickstatus`, `pickbatchno`, `stockUnitId`, `stock_unit_id`, `stock_unit_code`,`stock_unit_name`, `unitId`, `unit_code`,`unit_name`, `warehouse_id`,`warehouse_code`, `warehouse_name`, `product_id`, `product_name`, `product_code`, `product_sku_id`, `product_sku_code`, `product_sku_name`, `batchno_dxq`, `type`, `batchno`, `epc_tid`,`f_stock_count`, `productDate`, `invalidDate`, `epc_status`) values ");
		if (CollectionUtil.isNotEmpty(insertBatch)) {
			String separator0 = " , ";
			for (int i = 0; i < insertBatch.size(); i++) {
				StorerecordEntity item = insertBatch.get(i);
				sqlBuilder.append(" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?, ?,?,?, ?,?, ?) ");
				parameter.addParamWithType(item.getId(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrdercode(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrdertype(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderstatus(), Types.INTEGER);
				parameter.addParamWithType(item.getRfidcodeId(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderid(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderdetailid(), Types.VARCHAR);
				parameter.addParamWithType(item.getDr(), Types.SMALLINT);
				parameter.addParamWithType(item.getYtenant_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getPk_temp(), Types.VARCHAR);
				parameter.addParamWithType(item.getVersion(), Types.INTEGER);
				parameter.addParamWithType(item.getModify_time(), Types.TIMESTAMP);
				parameter.addParamWithType(item.getCreator(), Types.VARCHAR);
				parameter.addParamWithType(item.getModifier(), Types.VARCHAR);
				parameter.addParamWithType(item.getRfidcode(), Types.VARCHAR);
				parameter.addParamWithType(item.getOrderstoreId(), Types.VARCHAR);
				parameter.addParamWithType(item.getStockId(), Types.VARCHAR);
				parameter.addParamWithType(item.getPriceUOM(), Types.VARCHAR);
				parameter.addParamWithType(item.getInvExchRate(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnitExchangeType(), Types.VARCHAR);
				parameter.addParamWithType(item.getInvPriceExchRate(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnitExchangeTypePrice(), Types.VARCHAR);
				parameter.addParamWithType(item.getSourceid(), Types.VARCHAR);
				parameter.addParamWithType(item.getSourceautoid(), Types.VARCHAR);
				parameter.addParamWithType(item.getSource(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstsourceid(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstsourceautoid(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstsource(), Types.VARCHAR);
				parameter.addParamWithType(item.getUpcode(), Types.VARCHAR);
				parameter.addParamWithType(item.getFirstupcode(), Types.VARCHAR);
				parameter.addParamWithType(item.getPoid(), Types.VARCHAR);
				parameter.addParamWithType(item.getPodetailid(), Types.VARCHAR);
				parameter.addParamWithType(item.getPocode(), Types.VARCHAR);
				parameter.addParamWithType(item.getBatch_no(), Types.VARCHAR);
				parameter.addParamWithType(item.getPickstatus(), Types.INTEGER);
				parameter.addParamWithType(item.getPickbatchno(), Types.VARCHAR);
				parameter.addParamWithType(item.getStockUnitId(), Types.VARCHAR);
				parameter.addParamWithType(item.getStock_unit_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getStock_unit_code(), Types.VARCHAR);
				parameter.addParamWithType(item.getStock_unit_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnitId(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnit_code(), Types.VARCHAR);
				parameter.addParamWithType(item.getUnit_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getWarehouse_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getWarehouse_code(), Types.VARCHAR);
				parameter.addParamWithType(item.getWarehouse_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_code(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_sku_id(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_sku_code(), Types.VARCHAR);
				parameter.addParamWithType(item.getProduct_sku_name(), Types.VARCHAR);
				parameter.addParamWithType(item.getBatchno_dxq(), Types.VARCHAR);
				parameter.addParamWithType(item.getType(), Types.INTEGER);
				parameter.addParamWithType(item.getBatchno(), Types.VARCHAR);
				parameter.addParamWithType(item.getEpc_tid(), Types.VARCHAR);
				parameter.addParamWithType(item.getF_stock_count(), Types.DOUBLE);
				parameter.addParamWithType(item.getProductDate(), Types.VARCHAR);
				parameter.addParamWithType(item.getInvalidDate(), Types.VARCHAR);
				parameter.addParamWithType(item.getEpc_status(), Types.INTEGER);
				if (i < insertBatch.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
		}
		sqlBuilder.append(" ON DUPLICATE KEY UPDATE ordercode=VALUES(ordercode),ordertype=VALUES(ordertype) ,orderstatus=VALUES(orderstatus),rfidcodeId=VALUES(rfidcodeId),rfidcode=VALUES(rfidcode) ,orderid=VALUES(orderid),orderdetailid=VALUES(orderdetailid) ,dr=VALUES(dr),pk_temp=VALUES(pk_temp) ,version=VALUES(version),modify_time=VALUES(modify_time) ,creator=VALUES(creator),modifier=VALUES(modifier) ,orderstoreId=VALUES(orderstoreId),stockId=VALUES(stockId) ,priceUOM=VALUES(priceUOM) ,invExchRate=VALUES(invExchRate),unitExchangeType=VALUES(unitExchangeType) ,invPriceExchRate=VALUES(invPriceExchRate),unitExchangeTypePrice=VALUES(unitExchangeTypePrice) ,sourceid=VALUES(sourceid),sourceautoid=VALUES(sourceautoid) ,source=VALUES(source),firstsourceid=VALUES(firstsourceid) ,firstsourceautoid=VALUES(firstsourceautoid),firstsource=VALUES(firstsource) ,upcode=VALUES(upcode),firstupcode=VALUES(firstupcode) ,poid=VALUES(poid),podetailid=VALUES(podetailid) ,pocode=VALUES(pocode),batchno_dxq=VALUES(batchno_dxq) ,pickstatus=VALUES(pickstatus),pickbatchno=VALUES(pickbatchno) ,stockUnitId=VALUES(stockUnitId),stock_unit_id=VALUES(stock_unit_id) ,stock_unit_code=VALUES(stock_unit_code),stock_unit_name=VALUES(stock_unit_name) ,batchno=VALUES(batchno),epc_tid=VALUES(epc_tid),f_stock_count=VALUES(f_stock_count) ,productDate=VALUES(productDate),invalidDate=VALUES(invalidDate) ,batch_no=VALUES(batch_no),epc_status=VALUES(epc_status) ");

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.deleteByPrimaryKey
    
    public int deleteByPrimaryKey(String id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "delete from dxq_storerecord where `id` = ?\n";
        parameter.addParamWithType(id, Types.VARCHAR);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.deleteByIds
    
    public int deleteByIds(List<String> strList, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" delete from dxq_storerecord where id in ( ");
		if (CollectionUtil.isNotEmpty(strList)) {
			String separator0 = " , ";
			for (int i = 0; i < strList.size(); i++) {
				String item = strList.get(i);
				sqlBuilder.append(" ? ");
				parameter.addParamWithType(item, Types.VARCHAR);
				if (i < strList.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
		}
		sqlBuilder.append(" ) and ytenant_id=?; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.selectListByOrderid
    
    public List<StorerecordEntity> selectListByOrderid(String orderid, String tenant_id, String epcstatus) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select a.*   from dxq_storerecord a  where a.dr=0 and a.ytenant_id=?  and a.orderid = ? and a.epc_status = ?;\n";
        parameter.addParam(tenant_id);
		parameter.addParam(orderid);
		parameter.addParam(epcstatus);

        ResultSetProcessor processor = new AutoBeanListProcessor(new StorerecordEntity());
        return (List<StorerecordEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.StorerecordEntityMapper.editLocationId
    
    public int editLocationId(List<String> ids, String ordertype, String locationId, String tenant_id) {
        SQLParameter parameter = new SQLParameter(true);
        StringBuilder sqlBuilder = new StringBuilder();
		sqlBuilder.append(" update dxq_storerecord set locationId=?,epc_status=1 where ordertype=? and rfidcodeId in ");
		parameter.addParam(locationId);
		parameter.addParam(ordertype);
		if (CollectionUtil.isNotEmpty(ids)) {
			sqlBuilder.append(" ( ");
			String separator0 = " , ";
			for (int index = 0; index < ids.size(); index++) {
				String item = ids.get(index);
				sqlBuilder.append(" ? ");
				parameter.addParam(item);
				if (index < ids.size() - 1) {
					sqlBuilder.append(separator0);
				}
			}
			sqlBuilder.append(" ) ");
		}
		sqlBuilder.append(" and ytenant_id=? and dr=0; ");
		parameter.addParam(tenant_id);

        
        String sql = sqlBuilder.toString();
        
        return ymsJdbcApi.update(sql, parameter);
    }

}
